<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ page import="java.util.*"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>山西煤炭现货公路交易系统客户端</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<s:url value="/resources"/>/css/cupertino/jquery-ui.custom.min.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<s:url value="/resources"/>/css/ui.jqgrid.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<s:url value="/resources"/>/css/ui.multiselect.css" />
    <script type="text/javascript" src="<s:url value="/resources"/>/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="<s:url value="/resources"/>/js/jquery-ui.custom.min.js"></script>    
    <script type="text/javascript" src="<s:url value="/resources"/>/js/i18n/grid.locale-cn.js"></script> 
    <script type="text/javascript" src="<s:url value="/resources"/>/js/jquery.jqGrid.min.js"></script>
    <script type="text/javascript" src="<s:url value="/resources"/>/js/i18n/jquery.ui.datepicker-zh-CN.js"></script>    
 
</head>
<script type="text/javascript">
$(function(){  
    //loadTab(); 
    //loadHyhz();
    //loadSxf();
    //loadNotice();
 });
 
 function loadTab(){ 	 
    $("#myTab").jqGrid({      
    url:'htgl/findHtJqgrid.action',   
    datatype: 'json',
    mtype: 'post',            
   	colNames:['操作','合同号', '出卖人','发货单位','买受人','收货单位','煤种','品种','数量','签订日期','合同状态'],
   	colModel:[ 
   	    {name:'Verify',index:'id',width:40,align:"center",sortable:false},	  		
   		{name:'hetlrbh',index:'hetlrbh', width:120},
   		{name:'chumdwmc',index:'chumdwmc', width:120},
   		{name:'fahdwmc',index:'fahdwmc', width:90},
   		{name:'maisdwmc',index:'maisdwmc', width:120},
   		{name:'shouhdwmc',index:'shouhdwmc', width:90 },
   		{name:'meiz',index:'meiz', width:60},		
   		{name:'pinz',index:'pinz', width:60},   		
   		{name:'shul',index:'shul', width:50},
   		{name:'qianysj',index:'qianysj', width:80},
   		{name:'htzt',index:'htzt', width:70, sortable:false}
   	],
   
    jsonReader: {
           repeatitems : false, 
           id: 'hetbh'
         }, 
   	
   	rowNum:10,   	
   	rowList:[10,20,30],     	
   	pager: '#pager',
   	rownumbers: true,   	 
    viewrecords: true,
    //loadonce:true,
    //sortable:true,
    //sortname: 'hetlrbh',	
    sortorder: 'desc',
    altRows:true,
    //altclass:'ui-priority-secondary',
    //multiselect: true,  
	caption: "合同列表",
	ondblClickRow: select,
	gridComplete:function()
	{ //在此事件中循环为每一行添加修改和删除链接 
		var ids=jQuery("#myTab").jqGrid('getDataIDs'); 
		for(var j=0; j<ids.length; j++)
		{ 
			var id=ids[j]; 
			verify ="<a href='#' style='color:#f60' onclick='Verify("+ id +")'>查看</a>"; //这里的onclick就是调用了上面的javascript函数 Modify(id) 
			
			jQuery("#myTab").jqGrid('setRowData',ids[j], { Verify: verify }); 
		} 
	},
	loadComplete: function() {
        var grid = $("#myTab");
        var ids = grid.getDataIDs();
        for (var i = 0; i < ids.length; i++) {
            grid.setRowData ( ids[i], false, {height: 33} );
        }
    }		
  });
  
  $("#myTab").jqGrid('setGridHeight','330px');
  }
 function select() {
   var id = $("#myTab").jqGrid('getGridParam', 'selrow');
   //alert(id);
   openwindow('htgl/htcxInfo.action?htbh='+id);           
 }
 
 function Verify(id) { 
  
	openwindow('htgl/htcxInfo.action?htbh='+id.id);
 
}
 
 function openwindow(url){
      var sheight = screen.height-30;
	  var swidth = screen.width-1;
	  var winoption ="height="+sheight+"px,width="+ swidth +"px,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=yes,status=yes";
	  var result=window.open(url,"newwindow",winoption);
	  if(result ==1) window.location.reload(); 
	  return result; 
}

  function loadHyhz(){
    var url = "index/findHyhzList.action";    
      $.post(url,function(data){ 
        var obj = eval('(' + data + ')');
        var menu ="<ul>";
        var re=/(\d{1,3})(?=(\d{3})+(?:$|\.))/g;
        for(var i=0;i<obj.length;i++){
        var lisname=obj[i].lisname; 
        var shul=obj[i].shul                 
          menu+="<li><a href=\"#\" >【"+lisname+"】&nbsp;&nbsp;"+shul.toString().replace(re,"$1,")+"吨</a></li>";
        }
        menu+="</ul>";
        // alert(menu);
         $("#hyhz").html(menu);         
        });
  }
  
  function loadSxf(){
      var url = "index/findJysxfInfo.action";
      //alert(url);    
      $.post(url,function(data){ 
        var obj = eval('(' + data + ')');
        var re=/(\d{1,3})(?=(\d{3})+(?:$|\.))/g;
        var menu ="<ul>";
        menu+="<li><a href=\"#\" >【合同总量】&nbsp;&nbsp;"+obj[0].hetzl.toString().replace(re,"$1,")+"吨</a></li>";
        menu+="<li><a href=\"#\" >【应缴纳】&nbsp;&nbsp;"+obj[0].yingjje.toString().replace(re,"$1,")+"元</a></li>";
        menu+="<li><a href=\"#\" >【已缴纳】&nbsp;&nbsp;"+obj[0].yijje.toString().replace(re,"$1,")+"元</a></li>";
        menu+="<li><a href=\"#\" >【未缴纳】&nbsp;&nbsp;"+obj[0].weijje.toString().replace(re,"$1,")+"元</a></li>";
        menu+="</ul>";
        $("#sxf").html(menu); 
        });
  }
  
  function loadNotice(){
      var url = "index/findNoticeList.action";
      var url1="index/findNoticeInfo.action?noticeId=";
      $.post(url,function(data){ 
            var obj = eval('(' + data + ')');
            var menu ="<ul class=\"rightLink1\">";
            for(var i=0;i<obj.length;i++){            
            menu+="<li><a href="+url1+obj[i].noticeid+" target=\"mainFrame\">"+obj[i].subject+"</a></li>";
            }
            menu+="</ul>";        
            $("#notice").html(menu); 
            });
  }
  </script>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
 
			<img src="<s:url value="/resources"/>/images/mtfl_03.jpg" width="1264" height="672" alt=""> 
	 
 
 
</body>
</html>
